/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HMFS_RESIZE_COMMAND_H
#define HMFS_RESIZE_COMMAND_H

#include <iostream>
#include <string>
#include <sys/types.h>
#include <getopt.h>
#include "hmfs_command.h"

namespace OHOS {
namespace Hmfs {

// struct ResizeConfig {
//     int32_t debugLevel = 0;
//     int32_t force = 0;
//     int32_t safeResize = 0;
//     uint64_t targetSectors = 0;
//     int32_t largeNatBitmap = 0;
//     uint16_t sEncoding = 0;
//     uint16_t sEncodingFlags = 0;
//     uint32_t features = 0;
//     double newOverprovision;
// };

enum Option {
    END = -1,
    HELP = 'h',
    DEBUG = 'd',
    EXNODEBITMAP = 'i',
    OVERPROVISION = 'o',
    SAFE = 's',
    TARGETSECTOR = 't',
    FEATURELIST = 'O',
    ENCODING = 'C',
    RVERSION = 'V',
    FORCEWRITE = 'f',
    UNKNOWN = '?',
    NO_ARGUMENT = ':',
};

class ResizeCmdParser : public CmdParser {
public:
    ResizeCmdParser(CmdConfig &resizeConfig);
    ~ResizeCmdParser() = default;
    uint32_t Parse(int argc, char *argv[]);
    void ShowCmdUsage();

    // void SetTargetSectors();
    // void setDebugLevel();

private:
    ArgParseResult OptionAProcess(const std::string& argValue);

    // void InitCommand();
    // uint32_t ParseCommand(int argc, char *argv[]);
    // uint32_t CheckError(int argc, char *argv[], int c, int optIndex);
    ArgParseResult  PrintVersion(const std::string& argValue);
    // uint32_t CheckParam() const;
    // uint32_t HandleProcess(int c, const std::string& argValue);
    ArgParseResult  ShowHelp(const std::string& argValue);
    // bool IsLongOpt(int argc, char *argv[]) const;
    ArgParseResult SetDebugLevel(const std::string& argValue);
    ArgParseResult SetForce(const std::string& argValue);
    ArgParseResult SetSafe(const std::string& argValue);
    ArgParseResult SetTargetSectors(const std::string& argValue);
    ArgParseResult SetEncoding(const std::string& argValue);
    ArgParseResult SetOverProvision(const std::string& argValue);
    ArgParseResult SetExnodeBitmap(const std::string& argValue);
    ArgParseResult SetFeatureList(const std::string& argValue);
    std::vector<std::string> SplitStringList(const std::string& srcString, char delimiter);
    static const struct option CMD_OPTS[];
    static const std::string CMD_PARAMS;
    CmdConfig &resizeConfig_;
};

}
}
#endif // HMFS_RESIZE_COMMAND_H
